|
pac1811 2.2.0
|
API for configuring and manipulating PAC1811 Click driver. More...
Topics | |
| PAC1811 Registers List | |
| List of registers of PAC1811 Click driver. | |
| PAC1811 Registers Settings | |
| Settings for registers of PAC1811 Click driver. | |
| PAC1811 MikroBUS Map | |
| MikroBUS pin mapping of PAC1811 Click driver. | |
Functions | |
| void | pac1811_cfg_setup (pac1811_cfg_t *cfg) |
| PAC1811 configuration object setup function. | |
| err_t | pac1811_init (pac1811_t *ctx, pac1811_cfg_t *cfg) |
| PAC1811 initialization function. | |
| err_t | pac1811_default_cfg (pac1811_t *ctx) |
| PAC1811 default configuration function. | |
| err_t | pac1811_send_byte (pac1811_t *ctx, uint8_t data_in) |
| PAC1811 send single byte function. | |
| err_t | pac1811_receive_byte (pac1811_t *ctx, uint8_t *data_out) |
| PAC1811 receive single byte function. | |
| err_t | pac1811_write_byte (pac1811_t *ctx, uint8_t reg, uint8_t data_in) |
| PAC1811 write register function. | |
| err_t | pac1811_read_byte (pac1811_t *ctx, uint8_t reg, uint8_t *data_out) |
| PAC1811 read register function. | |
| err_t | pac1811_block_write (pac1811_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
| PAC1811 write registers function. | |
| err_t | pac1811_block_read (pac1811_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
| PAC1811 read registers function. | |
| err_t | pac1811_check_communication (pac1811_t *ctx) |
| PAC1811 communication check function. | |
| void | pac1811_enable_device (pac1811_t *ctx) |
| PAC1811 enable device function. | |
| void | pac1811_disable_device (pac1811_t *ctx) |
| PAC1811 disable device function. | |
| uint8_t | pac1811_get_a1_pin (pac1811_t *ctx) |
| PAC1811 get A1 pin function. | |
| err_t | pac1811_refresh (pac1811_t *ctx) |
| PAC1811 refresh function. | |
| err_t | pac1811_refresh_global (pac1811_t *ctx) |
| PAC1811 global refresh function. | |
| err_t | pac1811_refresh_wo_acc_reset (pac1811_t *ctx) |
| PAC1811 refresh without accumulator reset function. | |
| err_t | pac1811_set_fsr (pac1811_t *ctx, uint8_t vsense_fsr, uint8_t vbus_fsr) |
| PAC1811 set full-scale ranges function. | |
| err_t | pac1811_read_data (pac1811_t *ctx, pac1811_data_t *data_out) |
| PAC1811 read measurement data function. | |
API for configuring and manipulating PAC1811 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| err_t pac1811_block_read | ( | pac1811_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out, | ||
| uint8_t | len ) |
PAC1811 read registers function.
This function reads a desired number of data bytes starting from the selected register address.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
| [in] | reg | : Start register address. |
| [out] | data_out | : Output read data buffer. |
| [in] | len | : Number of bytes to read. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t pac1811_block_write | ( | pac1811_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_in, | ||
| uint8_t | len ) |
PAC1811 write registers function.
This function writes a desired number of data bytes starting from the selected register address.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
| [in] | reg | : Start register address. |
| [in] | data_in | : Data buffer to be written. |
| [in] | len | : Number of bytes to write. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void pac1811_cfg_setup | ( | pac1811_cfg_t * | cfg | ) |
PAC1811 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See pac1811_cfg_t object definition for detailed explanation. |
| err_t pac1811_check_communication | ( | pac1811_t * | ctx | ) |
PAC1811 communication check function.
This function verifies communication by reading product and manufacturer IDs and comparing them against expected values.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
0 - Success (IDs match), -1 - Error (IDs mismatch or bus error). See #err_t definition for detailed explanation. | err_t pac1811_default_cfg | ( | pac1811_t * | ctx | ) |
PAC1811 default configuration function.
This function executes a default configuration of PAC1811 Click board.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void pac1811_disable_device | ( | pac1811_t * | ctx | ) |
PAC1811 disable device function.
This function disables device by setting the PWR pin to low logic state.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
| void pac1811_enable_device | ( | pac1811_t * | ctx | ) |
PAC1811 enable device function.
This function enables device by setting the PWR pin to high logic state.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
| uint8_t pac1811_get_a1_pin | ( | pac1811_t * | ctx | ) |
PAC1811 get A1 pin function.
This function reads the logic level of the A1 pin.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
0 - Logic low, 1 - Logic high. | err_t pac1811_init | ( | pac1811_t * | ctx, |
| pac1811_cfg_t * | cfg ) |
PAC1811 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See pac1811_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t pac1811_read_byte | ( | pac1811_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out ) |
PAC1811 read register function.
This function reads a single byte from the selected register address.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [out] | data_out | : Output read data byte. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t pac1811_read_data | ( | pac1811_t * | ctx, |
| pac1811_data_t * | data_out ) |
PAC1811 read measurement data function.
This function reads accumulated count, voltage, current, and power data, and converts raw codes into SI units, storing the results to the output structure.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
| [out] | data_out | : Output measurement data structure. See pac1811_data_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t pac1811_receive_byte | ( | pac1811_t * | ctx, |
| uint8_t * | data_out ) |
PAC1811 receive single byte function.
This function receives a single byte from the I2C bus.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
| [out] | data_out | : Output read data byte. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t pac1811_refresh | ( | pac1811_t * | ctx | ) |
PAC1811 refresh function.
This function issues a REFRESH command to update measurement registers.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t pac1811_refresh_global | ( | pac1811_t * | ctx | ) |
PAC1811 global refresh function.
This function sends a global REFRESH command via the general-call address and then restores the device's slave address.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t pac1811_refresh_wo_acc_reset | ( | pac1811_t * | ctx | ) |
PAC1811 refresh without accumulator reset function.
This function issues a REFRESH_V command to update measurement registers without resetting accumulators.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t pac1811_send_byte | ( | pac1811_t * | ctx, |
| uint8_t | data_in ) |
PAC1811 send single byte function.
This function transmits a single byte on the I2C bus.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
| [in] | data_in | : Data byte to send. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t pac1811_set_fsr | ( | pac1811_t * | ctx, |
| uint8_t | vsense_fsr, | ||
| uint8_t | vbus_fsr ) |
PAC1811 set full-scale ranges function.
This function configures full-scale ranges (FSR) for V(SENSE) and V(BUS).
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
| [in] | vsense_fsr | : V(SENSE) FSR selection (see PAC1811_FSR_*). |
| [in] | vbus_fsr | : V(BUS) FSR selection (see PAC1811_FSR_*). |
0 - Success, -1 - Error (invalid range or bus error). See #err_t definition for detailed explanation. | err_t pac1811_write_byte | ( | pac1811_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t | data_in ) |
PAC1811 write register function.
This function writes a single byte to the selected register address.
| [in] | ctx | : Click context object. See pac1811_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | data_in | : Data byte to be written. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation.